/*
 * $Id: filter.h,v 1.10.6.2 Broadcom SDK $
 * 
 * $Copyright: Copyright 2011 Broadcom Corporation.
 * This program is the proprietary software of Broadcom Corporation
 * and/or its licensors, and may only be used, duplicated, modified
 * or distributed pursuant to the terms and conditions of a separate,
 * written license agreement executed between you and Broadcom
 * (an "Authorized License").  Except as set forth in an Authorized
 * License, Broadcom grants no license (express or implied), right
 * to use, or waiver of any kind with respect to the Software, and
 * Broadcom expressly reserves all rights in and to the Software
 * and all intellectual property rights therein.  IF YOU HAVE
 * NO AUTHORIZED LICENSE, THEN YOU HAVE NO RIGHT TO USE THIS SOFTWARE
 * IN ANY WAY, AND SHOULD IMMEDIATELY NOTIFY BROADCOM AND DISCONTINUE
 * ALL USE OF THE SOFTWARE.  
 *  
 * Except as expressly set forth in the Authorized License,
 *  
 * 1.     This program, including its structure, sequence and organization,
 * constitutes the valuable trade secrets of Broadcom, and you shall use
 * all reasonable efforts to protect the confidentiality thereof,
 * and to use this information only in connection with your use of
 * Broadcom integrated circuit products.
 *  
 * 2.     TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS
 * PROVIDED "AS IS" AND WITH ALL FAULTS AND BROADCOM MAKES NO PROMISES,
 * REPRESENTATIONS OR WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY,
 * OR OTHERWISE, WITH RESPECT TO THE SOFTWARE.  BROADCOM SPECIFICALLY
 * DISCLAIMS ANY AND ALL IMPLIED WARRANTIES OF TITLE, MERCHANTABILITY,
 * NONINFRINGEMENT, FITNESS FOR A PARTICULAR PURPOSE, LACK OF VIRUSES,
 * ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET POSSESSION OR
 * CORRESPONDENCE TO DESCRIPTION. YOU ASSUME THE ENTIRE RISK ARISING
 * OUT OF USE OR PERFORMANCE OF THE SOFTWARE.
 * 
 * 3.     TO THE MAXIMUM EXTENT PERMITTED BY LAW, IN NO EVENT SHALL
 * BROADCOM OR ITS LICENSORS BE LIABLE FOR (i) CONSEQUENTIAL,
 * INCIDENTAL, SPECIAL, INDIRECT, OR EXEMPLARY DAMAGES WHATSOEVER
 * ARISING OUT OF OR IN ANY WAY RELATING TO YOUR USE OF OR INABILITY
 * TO USE THE SOFTWARE EVEN IF BROADCOM HAS BEEN ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGES; OR (ii) ANY AMOUNT IN EXCESS OF
 * THE AMOUNT ACTUALLY PAID FOR THE SOFTWARE ITSELF OR USD 1.00,
 * WHICHEVER IS GREATER. THESE LIMITATIONS SHALL APPLY NOTWITHSTANDING
 * ANY FAILURE OF ESSENTIAL PURPOSE OF ANY LIMITED REMEDY.$
 * 
 * DO NOT EDIT THIS FILE!
 * This file is auto-generated.
 * Edits to this file will be lost when it is regenerated.
 */

#ifndef __BCMX_FILTER_H__
#define __BCMX_FILTER_H__

#include <bcm/types.h>
#include <bcmx/bcmx.h>
#include <bcmx/lplist.h>
#include <bcm/filter.h>

/* Initialize filter subsystem. */
extern int bcmx_filter_init(void);

/* Create a blank filter template. */
extern int bcmx_filter_create(
    bcm_filterid_t *f_return);

/* Create a blank filter template with requested filter ID. */
extern int bcmx_filter_create_id(
    bcm_filterid_t f);

/* Destroy a filter template. */
extern int bcmx_filter_destroy(
    bcm_filterid_t f);

/* Copy a filter template. */
extern int bcmx_filter_copy(
    bcm_filterid_t f_src, 
    bcm_filterid_t *f_return);

/* 
 * Set priority of this filter relative to other filters that match
 * simultaneously.
 */
extern int bcmx_filter_qualify_priority(
    bcm_filterid_t f, 
    int prio);

/* Set ingress port(s) that the packet must match to trigger filter. */
extern int bcmx_filter_qualify_ingress(
    bcm_filterid_t f, 
    bcmx_lplist_t lplist);

/* Add egress port(s) that the packet must match to trigger filter. */
extern int bcmx_filter_qualify_egress(
    bcm_filterid_t f, 
    bcmx_lplist_t lplist);

/* Set a filter to match only a particular egress module ID. */
extern int bcmx_filter_qualify_egress_modid(
    bcm_filterid_t f, 
    int module_id);

/* Set a filter to match only unknown unicast packets. */
extern int bcmx_filter_qualify_unknown_ucast(
    bcm_filterid_t f);

/* Set a filter to match only unknown multicast packets. */
extern int bcmx_filter_qualify_unknown_mcast(
    bcm_filterid_t f);

/* Set a filter to match only known unicast packets. */
extern int bcmx_filter_qualify_known_ucast(
    bcm_filterid_t f);

/* Set a filter to match only known multicast packets. */
extern int bcmx_filter_qualify_known_mcast(
    bcm_filterid_t f);

/* Set a filter to match only broadcast packets. */
extern int bcmx_filter_qualify_broadcast(
    bcm_filterid_t f);

/* Set a filter to stop lower priority rules check on a match. */
extern int bcmx_filter_qualify_stop(
    bcm_filterid_t f, 
    int partial_match);

/* Set a filter to match only a particular packet format. */
extern int bcmx_filter_qualify_format(
    bcm_filterid_t f, 
    bcm_filter_format_t format);

/* Add data field that the packet must match to trigger filter. */
extern int bcmx_filter_qualify_data(
    bcm_filterid_t f, 
    int offset, 
    int len, 
    const uint8 *data, 
    const uint8 *mask);

/* Add data field that the packet must match to trigger filter. */
extern int bcmx_filter_qualify_data8(
    bcm_filterid_t f, 
    int offset, 
    uint8 val, 
    uint8 mask);

/* Add data field that the packet must match to trigger filter. */
extern int bcmx_filter_qualify_data16(
    bcm_filterid_t f, 
    int offset, 
    uint16 val, 
    uint16 mask);

/* Add data field that the packet must match to trigger filter. */
extern int bcmx_filter_qualify_data32(
    bcm_filterid_t f, 
    int offset, 
    uint32 val, 
    uint32 mask);

/* Associate action to be performed when filter matches a packet. */
extern int bcmx_filter_action_match(
    bcm_filterid_t f, 
    bcm_filter_action_t action, 
    uint32 param);

/* 
 * Associate action to be performed with filter when filter rule is NOT
 * matched.
 */
extern int bcmx_filter_action_no_match(
    bcm_filterid_t f, 
    bcm_filter_action_t action, 
    uint32 param);

/* 
 * Associate action to be performed with filter when filter rule is
 * matched for an out-of-profile packet.
 */
extern int bcmx_filter_action_out_profile(
    bcm_filterid_t f, 
    bcm_filter_action_t action, 
    uint32 param, 
    int meter_id);

/* Install a filter into the hardware tables. */
extern int bcmx_filter_install(
    bcm_filterid_t f);

/* Re-Install a filter into the hardware tables. */
extern int bcmx_filter_reinstall(
    bcm_filterid_t f);

/* Remove a filter from the hardware tables. */
extern int bcmx_filter_remove(
    bcm_filterid_t f);

/* Remove all filters from the hardware tables. */
extern int bcmx_filter_remove_all(void);

#endif /* __BCMX_FILTER_H__ */
